package com.alibaba.dubbo.common.serialize.support.kryo;

import com.alibaba.dubbo.common.URL;
import com.alibaba.dubbo.common.serialize.ObjectInput;
import com.alibaba.dubbo.common.serialize.ObjectOutput;
import com.alibaba.dubbo.common.serialize.Serialization;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

/**
 * Created by sunlei on 2016/2/18.
 */
public class KryoSerialization  implements OptimizedSerialization{
    public byte getContentTypeId() {
        return 10;
    }

    public String getContentType() {
        return "kryo";
    }

    public ObjectOutput serialize(URL url, OutputStream output) throws IOException {
        return new KryoObjectOutput(output);
    }

    public ObjectInput deserialize(URL url, InputStream input) throws IOException {
        return new KryoObjectInput(input);
    }
}
